
import { login } from '@/api/services/loginService'

const userManager = {
  actions: {
    login ({ commit }, userInfo) {
      const username = userInfo.username.trim()
      return new Promise((resolve, reject) => {
        login(username, userInfo.password).then(response => {
          resolve(response) // 返回到 then
        }).catch(error => {
          reject(error) // 返回到 catch
        })
      })
    }
  }
}

export default userManager
